var a = require("../../../@babel/runtime/helpers/toConsumableArray"), t = getApp();

Page({
    data: {
        currentTime: new Date().getTime(),
        active: "0",
        listData: [],
        shareShow: !1,
        shareOptions: [ {
            name: "生成海报",
            icon: "poster"
        }, {
            name: "分享给好友",
            icon: "wechat",
            openType: "share"
        } ],
        openShareId: 0,
        openShareImg: "",
        deliver_id: 0,
        isLoadMore: !0,
        total_page: 0,
        page: 1
    },
    onLoad: function(a) {
        this.getListData();
    },
    onReady: function() {},
    changeTags: function(a) {
        this.data.active = a.detail.index, this.getListData();
    },
    onSelectShare: function(a) {
        this.onCloseShare(), 0 == a.detail.index && this.setData({
            posterShow: !0
        }), console.log(a.detail.index);
    },
    onCloseShare: function() {
        this.setData({
            shareShow: !1
        });
    },
    openShareShow: function(a) {
        var t = a.currentTarget.dataset.item;
        this.setData({
            openShareId: t.id,
            openShareImg: t.share_img,
            shareShow: !0
        });
    },
    gotoIndex: function() {
        wx.navigateTo({
            url: "/packageE/community_buying/index/index"
        });
    },
    gotoBuyingOrder: function() {
        wx.navigateTo({
            url: "/packageE/community_buying/buying_order/buying_order"
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this.getMoreListData() : console.log("没有更多数据");
    },
    gotoBuyingOrderId: function(a) {
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageE/community_buying/buying_order/buying_order?buyingid=" + t
        });
    },
    gotoBuyingDetails: function(a) {
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageE/community_buying/buying_details/buying_details?buyingid=" + t
        });
    },
    getListData: function() {
        var a = this, e = t.getNetAddresss("plugin.package-deliver.frontend.communityGroups.groupList");
        t._postNetWork({
            url: e,
            data: {
                status: this.data.active
            },
            success: function(t) {
                var e = t.data;
                console.log(e), 1 == e.result && (a.data.total_page = e.data.list.last_page, e.data.list.current_page >= e.data.list.last_page && (a.data.isLoadMore = !1), 
                a.setData({
                    deliver_id: e.data.deliver_id,
                    listData: e.data.list.data
                }));
            }
        });
    },
    getMoreListData: function() {
        var e = this, i = t.getNetAddresss("plugin.package-deliver.frontend.communityGroups.groupList");
        this.data.page++, t._postNetWork({
            url: i,
            data: {
                status: this.data.active,
                page: this.data.page
            },
            success: function(t) {
                var i = t.data;
                if (console.log(i), 1 == i.result) {
                    e.data.total_page = i.data.list.last_page, i.data.list.current_page >= i.data.list.last_page && (e.data.isLoadMore = !1);
                    var n = e.data.listata;
                    n.push.apply(n, a(i.data.list.data)), e.setData({
                        listData: n
                    });
                }
            }
        });
    },
    onShareAppMessage: function() {
        var a = "/packageE/community_buying/buying_personal/buying_personal?buyingid=" + this.data.openShareId + "&deliver_id=" + this.data.deliver_id, t = wx.getStorageSync("yz_uid");
        t && (a = a + "&mid=" + t);
        var e = {
            path: a
        };
        return this.data.openShareImg && (e.imageUrl = this.data.openShareImg), e;
    }
});